package  
{
	import flash.display.Sprite;
	import gui.NumStepper;
	/**
	 * ...
	 * @author Dmitriy Gaiduk
	 */
	public class TestXml extends Sprite
	{
		
		public function TestXml() 
		{
			initTest();
		}
		
		private function initTest():void 
		{
			/*var xml:XML = <text title="Сторона шкафа для дверцы" align="centr" y="40" />;
			var xpos:String = xml.attribute("x");
			trace(xml.attribute("title"));
			trace(xml.attribute("align"));
			trace(xml.attribute("y"));
			trace("xpos: " + "|" + xpos + "|" + " len: " + xpos.length);*/
			var nums:Array = getArrayFromString("1.1, 2, q 3.5,0.8 e4, rt79");
			if (nums == null)
			{
				trace("no numbers");
				return;
			}
			trace("Numbers: ");
			for (var i:int = 0; i < nums.length; i++ )
			{
				trace(i.toString() + " " + nums[i]);
			}
		}
		
		private function getArrayFromString(pointsStr:String):Array
		{
			//var arrRegExp:RegExp = /(\s*[0-9][0-9]*\.?[0-9]*\s*\,\s*){0,}\s*[0-9][0-9]*\.?[0-9]*\s*/g;
			var numberRegExp:RegExp = /[0-9][0-9]*\.?[0-9]*/g;
			var arrMatch:Array = pointsStr.match(numberRegExp);
			var numbersArr:Array = [];
			if (arrMatch != null)
			{
				var num:Number;
				numbersArr = [];
				for (var i:int = 0; i < arrMatch.length; i++ )
				{
					num = Number(arrMatch[i]);
					if (!isNaN(num))
					{
						numbersArr.push(num);
					}else
					{
						handleError("NaN getArrayFromString: " + pointsStr);
					}
					
				}
			}else
			{
				handleError("no mathes");
			}
			return numbersArr;
		}
		
		private function handleError(err:String):void 
		{
			trace("test page: " + err);
		}
		
	}

}